<?php
class Model_upload_image_product extends MVC_MODEL {
	/**
	 * @var object SQL
	 */
	public $oDb_upload_image_product;
	
	public function __construct(){
		parent::__construct();
		$this->oDb_upload_image_product = new Db_upload_image_product();
	}
	public function getListupload_image_product(){
		return $this->oDb_upload_image_product->getListupload_image_product($this);
	}
	public function getListProvince(){
		return $this->oDb_upload_image_product->getListProvince($this);
	}
	public function do_insert_new_upload_image_product(){
		return $this->oDb_upload_image_product->doInsert($this->getAllData(),true);
	}	
	public function deleteupload_image_product(){
		return $this->oDb_upload_image_product->doDeleteByPK($this->getData('upload_image_product_id'));;
	}	
	public function deleteImageOfupload_image_product(){
		return $this->oDb_upload_image_product->deleteImageOfupload_image_product($this->getData('upload_image_product_id'));;
	}	
		
	public function updateupload_image_productStatus()
	{	
		return $this->oDb_upload_image_product->updateupload_image_productStatus($this->getAllData());
	}
	public function getInfoupload_image_product()
	{
		return $this->oDb_upload_image_product->getInfoupload_image_product($this->getData('upload_image_product_id'));
	}
	public function update_file_name($aData)
	{	
		return $this->oDb_upload_image_product->doUpdateByPK($aData);
	}
	public function  setDataForCheckbox($arrayName,$_POST)
	{
			foreach ($arrayName as $control)
			{
				
				if ($_POST[$control] != "" && $_POST[$control] != null) 
				{
					$_POST[$control] =1;
				}
					else $_POST[$control] =0;
				
				
			}
			return $_POST;
	}
	public function doUpdateImagesItemProduct($aData){
		return $this->oDb_upload_image_product->doUpdateImagesItemProduct($aData);		
	}
	public function getImage($pictures_product_id){
		return $this->oDb_upload_image_product->getImage($pictures_product_id);		
	}
	public function getAllImage_db(){
		return $this->oDb_upload_image_product->getAllImage_db($this);		
	}
	public function insertImage(){
		return $this->oDb_upload_image_product->doInsert($this->getAllData(),true);		
	}	
	public function deleteImageList($aData){
		return $this->oDb_upload_image_product->deleteImageList($aData);		
	}
	public function filter_image($aData){
		return $this->oDb_upload_image_product->filter_image($aData);		
	}
	public function GenPicsId()
	{
		return $this->oDb_upload_image_product->GenPicsId();
	}
}
?>